// ignore_for_file: prefer_const_constructors, prefer_interpolation_to_compose_strings, use_super_parameters, file_names

import 'package:flutter/material.dart';

import 'package:get/get.dart';

class StateObx extends StatelessWidget {
  StateObx({Key? key}) : super(key: key);

  final count = 0.obs;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Obx(...)"),
      ),
      body: Center(
        child: Column(
          children: [
            Text("final count = 0.obs; Obx(Text(count.toString()))",style: TextStyle(fontSize: 15)),
            SizedBox(height: 25,),
            Obx(() => Text("count1 -> " + count.toString(),style: TextStyle(fontSize: 20),)),
            SizedBox(height: 25,),
            Divider(),
            SizedBox(height: 25,),
            ElevatedButton(
              onPressed: () {
                count.value++;
              },
              child: Text('add',style: TextStyle(fontSize: 20),),
            ),
          ],
        ),
      ),
    );
  }
}
